package org.springblade.oa.wrappper;

import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.oa.entity.Bxxcmx;
import org.springblade.oa.service.IBxxcmxService;
import org.springblade.oa.service.IExpenseAccountService;
import org.springblade.oa.vo.BxxcmxVO;
import org.springblade.pm.feign.IXmglProjectClient;
import org.springblade.system.feign.IDictClient;

/**
 * @author LK
 * @version 1.0.0
 * @Title: BxxcmxWrapper.java
 * @Description: TODO    返回视图报销行程明细
 * @date 2020/1/16 14:50
 */
public class BxxcmxWrapper extends BaseEntityWrapper<Bxxcmx, BxxcmxVO> {
	private static IXmglProjectClient xmglProjectClient;
	private static IBxxcmxService bxxcmxService;
	private static IExpenseAccountService expenseAccountService;
	private static IDictClient dictClient;

	static {
		dictClient = SpringUtil.getBean(IDictClient.class);
		bxxcmxService = SpringUtil.getBean(IBxxcmxService.class);
		expenseAccountService = SpringUtil.getBean(IExpenseAccountService.class);
		xmglProjectClient = SpringUtil.getBean(IXmglProjectClient.class);
	}

	public static BxxcmxWrapper build() {
		return new BxxcmxWrapper();
	}

	@Override
	public BxxcmxVO entityVO(Bxxcmx bxxcmx) {
		BxxcmxVO bxxcmxVO = BeanUtil.copy(bxxcmx, BxxcmxVO.class);
		bxxcmx.getXmbh();
		bxxcmxVO.setXmbhName(expenseAccountService.getProjectName(bxxcmx.getXmbh()));
		bxxcmxVO.setXmbhAbbName(expenseAccountService.getProjectAbbName(bxxcmx.getXmbh()));
		return bxxcmxVO;
	}
}
